package com.xian.loop;

public class ForDemo3 {
    public static void main(String[] args) {
        //目标:求水仙花数(100-999)
        //三位数---各位数的立方和等于原数

        int count = 0;
        for (int i = 100; i < 999; i++) {
            //个位
            int ge = i % 10;
            //十位
            int shi = i / 10 % 10;
            //百位
            int bai = i / 100;

            if(ge*ge*ge + shi*shi*shi + bai*bai*bai == i){
//                System.out.println(i);
                count++;
                System.out.print(i+"\t");
            }

        }
        System.out.println();
        System.out.println(count+"个");
    }
}
